package com.unieagle.exam.utils;

import java.io.File;
import java.io.FileInputStream;

import android.util.Base64;

public class Base64Utils {

    public static String encode(File file) {
        String encodedString = "";
        FileInputStream inputFile;
        try {
            inputFile = new FileInputStream(file);
            byte[] buffer = new byte[(int) file.length()];
            inputFile.read(buffer);
            inputFile.close();
            encodedString = Base64.encodeToString(buffer, Base64.NO_WRAP);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return encodedString;
    }

}
